package myrule;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/***
 * 注入配置规则
 * @author zhangshuai
 * @date 2021-5-8 13:53
 * @param
 * @return
 **/
@Configuration
public class MySelfRule {
    @Bean
    public IRule myRule() {
        //return new RoundRobinRule();
        return new DecodeServerChooseRule();
        //达到的目的，用我们重新选择的随机算法替代默认的轮询。

    }
}
